package com.mys2sh.action;

import com.mys2sh.model.User;
import com.mys2sh.service.UserService;
import com.opensymphony.xwork2.ActionSupport;

@SuppressWarnings("serial")
public class RegAction extends ActionSupport {

	private User user;
	private String repassWord;
	private UserService userService;

	public String getRepassWord() {
		return repassWord;
	}

	public void setRepassWord(String repassWord) {
		this.repassWord = repassWord;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public UserService getUserService() {
		return userService;
	}

	public void setUserService(UserService userService) {
		this.userService = userService;
	}

	@Override
	public String execute() throws Exception {
		if (userService.checkDupUser(user.getUserName())) {
			addActionError("该用户已存在！");
			return INPUT;
		}
		userService.setUserinfo(user);
		return SUCCESS;
	}

}
